<template>
    <el-dialog v-model="isShow" title="下架操作：" draggable destroy-on-close append-to-body>
        <div class="flex_str_str">
            <div>下架原因：</div>
            <textarea class="textSty" v-model="adoptParams.nt"></textarea>
        </div>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="cancel">取消</el-button>
                <el-button type="primary" @click="adoptFun">
                    确定
                </el-button>
            </span>
        </template>
    </el-dialog>
</template>
<script lang="ts" setup>
import { reactive, ref, toRefs } from 'vue'
import { lowerHouseApi } from '@/api/index/index'
import { ElMessage } from 'element-plus';
const props = defineProps({
    isShow: {
        type: Boolean,
        defaul: false
    },
    id: {
        type: Number,
        default: 0
    }
})
const emit = defineEmits(['close'])
const { isShow, id } = toRefs(props)
console.log(id.value)
const adoptParams = reactive({
    nt: '',
    id: id.value
})
const cancel = () => {
    emit('close')
}
const adoptFun = () => {
    lowerHouseApi(adoptParams).then((res: any) => {
        if (res.status == 200) {
            adoptParams.id = 0
            ElMessage.success('已下架')
            emit('close')
        }
    })
}
</script>
<style scoped>
.textSty {
    width: 400px;
    height: 200px;
    resize: none;
}

.dialog-footer button:first-child {
    margin-right: 10px;
}
</style>